package cn.csust.net2.manager.shared.service;

import cn.csust.net2.manager.shared.exception.BeyondAuthorityException;
import cn.csust.net2.manager.shared.po.Research;
import cn.csust.net2.manager.shared.po.ResearchAnswer;
import cn.csust.net2.manager.shared.po.ResearchResult;
import cn.csust.net2.manager.shared.po.ResearchTitle;
import cn.csust.net2.manager.shared.util.ServiceConstant;

import com.extjs.gxt.ui.client.data.PagingLoadConfig;
import com.extjs.gxt.ui.client.data.PagingLoadResult;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

@RemoteServiceRelativePath(value = ServiceConstant.MANAGER+ServiceConstant.SERVICE_NAME_RESEARCHCOMMON)
public interface ResearchCommonService extends BaseService {
	public static final String RESEARCH_TITLEID = "reserachTitleID";
	public static final String RESEARCHID ="researchID";
	public static final String USERID ="userID";
	public static final String RESERACH_RESULT_SET ="reserachResultSet";
	public static final String RESEARCH = "research";
	public static final String RESEARCH_TITLE_SET = "researchTitleSet";
	public static final String RESEARCH_ANSWER_SET = "researchAnswerSet";
	public static final String RESERACH_TITLEID = "reserachTitleID";
	public static final String STUDENT_NUMBERLIST = "studentNumberList";
	/*
	 * config 
	 * 参数                                                       说明
	 * studnetNumber 			学号（此学生需要做得投票）
	 * startTime 				开始时间（查询限制条件）
	 * endTime					结束时间（查询限制条件）
	 */
	public PagingLoadResult<Research> findResearchsByPaging(PagingLoadConfig config)throws BeyondAuthorityException;	
	/*
	 * config 参数 “ResearchID” 
	 * 返回此Research 的所有ResearchResult
	 */
	public PagingLoadResult<ResearchResult> findResearchResultsByPaging(PagingLoadConfig config)throws BeyondAuthorityException;

	/*
	 * config 参数 “ResearchID” 
	 * 返回此Research 的所有Researchanswers
	 */
	public PagingLoadResult<ResearchAnswer> findResearchAnswersByPaging(PagingLoadConfig config)throws BeyondAuthorityException;
	
	
	/*
	 * 考虑到网络传输量问题 ，所以尽量不在config里添加对象而直接添加属性
	 * 而且很多情况下我们只用到了属性
	 * config 参数 ResearchID
	 * studentNumberList  此为StudentNumber的List<Long>集
	 * 存入 student_Research 表中
	 */
	public void saveStudent_ResearchByPaging(PagingLoadConfig config)throws BeyondAuthorityException;
	
	/*
	 * config 参数ResearchID
	 * 返回student_Research表中 对应 StudentNumber的集合
	 */
	public PagingLoadResult<Long> findStudent_ResearchByPaging(PagingLoadConfig config)throws BeyondAuthorityException;
	
	/*
	 * 返回 answerID 为l的所有Researchresult的数量
	 */
	public int findResearchResultsByAnswerID(Long l)throws BeyondAuthorityException;
	
	/*
	 * 判断student_research 表中是否有 studentNumber 为l 的记录
	 * 有则返回ture 没有则返回false  
	 */
	public boolean hasResearchResultsByStudnetNumber(Long l)throws BeyondAuthorityException;
	
	/*
	 * 参数   reserachID
	 */
	public PagingLoadResult<ResearchTitle> findResearchTitlesByPaging(PagingLoadConfig config)throws BeyondAuthorityException;
	
}
